<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <title>发件箱</title>
    <script language="JavaScript" src="${pageContext.request.contextPath}/luhong/mydate.js"></script>
    <script type="text/javascript">
    
    		//清空时间
    		function freeTime(){
    			document.getElementById("starttime").value="";
    			document.getElementById("endtime").value="";
    		}
    		function skipPage(currentPage){
        		var url='${pageContext.request.contextPath }/aleadyEmail.action?method=queryAreadyEmail&currPage='+currentPage;
        		window.location.href=url;
      		}
    		function send(id){
    			var url='${pageContext.request.contextPath }/aleadyEmail.action?method=sendAgainEmail&eid='+id;
        		window.location.href=url;
    		}
    		function del(id){
    			if(confirm("您确定要删除吗？")){
    				var url='${pageContext.request.contextPath }/aleadyEmail.action?method=delaleadyEmail&eid='+id;
        			window.location.href=url;
        		}
    		}
    		function query(){
    			var id=document.getElementById("sid").value;
    			var stime=document.getElementById("starttime").value;
    			var etime=document.getElementById("endtime").value;
    			var url='${pageContext.request.contextPath }/aleadyEmail.action?method=queryAreadyEmail&sid='+id+'&stime='+stime+'&etime='+etime;
        		window.location.href=url;
    		}
    		var oldColor;
			function choice(trObj) {
				oldColor = trObj.bgColor;
				trObj.bgColor = "yellow";
			}
			function leave(trObj) {
				trObj.bgColor = oldColor;
			}
    </script>
    <style type="text/css">
    		a{
    			cursor:pointer;
    		}
    		body {
				background-image:
				url(${pageContext.request.contextPath}/images/forum7.jpg);
			}
			td{
				font-size:14px;
			}
    </style>
    
  </head>
  
  <body>
   <center><strong>发件箱</strong></center>
  	 收件人姓名:<input type="text" name="sid" id="sid" value="${requestScope.aRecipientid}"/>
  	写件时间：
  	<input type="text" name="starttime" id="starttime" onfocus="MyCalendar.SetDate(this)" value="${requestScope.satime }" readonly>
   	--<input type="text" name="endtime" id="endtime" onfocus="MyCalendar.SetDate(this)" value="${requestScope.eatime }" readonly>
   	<input type="button" value="清空时间" onclick="freeTime();">
   <input type="button" value="查找" onclick="query();">
   <br/>
   <br/>
   <br/>
   <div style="height:320px;">
   <table align="center" border="1px" cellspacing="0px" cellpadding="0px">
   	<tr>
   		<td>收件人</td>
   		<td>Email主题</td>
   		<td>邮件附录地址1</td>
   		<td>邮件附录地址2</td>
   		<td>邮件附录地址3</td>
   		<td>邮件正文</td>
   		<td>发件时间</td>
   		<td>编辑</td>
   	</tr>
   	<tr>
   		<c:forEach items="${requestScope.aleadypage.maildata}" var="view" varStatus="c">
   	 		<tr bgcolor="${c.index%2==0?'white':'skyblue'}" onmouseover=choice(this); onmouseout=leave(this);>
   	 			<td>${view.recipientName }(${view.recipientId })</td>
   	 			<td>${view.emailTopic }</td>
   	 			<td><a href="${pageContext.request.contextPath}/file/EmailFile/${view.emailFile1Add}">${view.emailFile1}</a></td>
   	 			<td><a href="${pageContext.request.contextPath}/file/EmailFile/${view.emailFile2Add}">${view.emailFile2}</a></td>
   	 			<td><a href="${pageContext.request.contextPath}/file/EmailFile/${view.emailFile3Add}">${view.emailFile3}</a></td>
   	 			<td>${view.emailText }</td>
   	 			<td>${view.emailDate }</td>
   	 			 <td><a onclick="send('${view.emailId }');">重发</a>&nbsp;<a onclick="del('${view.emailId }');">删除</a></td>
   	 		</tr>
   	 	</c:forEach>
   	</tr>
   </table>
   </div>
   <table align="center">
			<tr>
				<td>
					<a onclick="skipPage('1')";>首页</a>
				</td>
				<td>
					<a
						onclick="skipPage('${requestScope.aleadypage.currentPage==1?1:requestScope.aleadypage.currentPage-1 }');">上一页</a>
				</td>
				<td>
					<a
						onclick="skipPage('${requestScope.aleadypage.currentPage==requestScope.aleadypage.totalPage?

(requestScope.aleadypage.currentPage):(requestScope.aleadypage.currentPage+1) }');">下一页</a>
				</td>
				<td>
					<a onclick="skipPage('${requestScope.aleadypage.totalPage}');">末页</a>
				</td>
				<td>
					当前页码：${requestScope.aleadypage.currentPage}/${requestScope.aleadypage.totalPage}
				</td>
			</tr>
		</table>
  </body>
</html>
